<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="layout :: common_header(~{::title})">
    <title >商品发货管理-电商ERP</title>
</head>
<body th:replace="layout :: common_body(~{::div.layui-body})">

<div class="layui-body" style="padding:15px;">
    <style type="text/css">
        .update {
            display: inline-block;
            margin-left: 15px;
            padding: 0 20px;
            height: 40px;
            line-height: 40px;
            font-size: 14px;
            background: #009789;
            color: #fff;
            text-align: center;
            border-radius: 3px;
            cursor: pointer;
        }

        .update i {
            display: inline-block;
            margin-right: 10px;
            vertical-align: middle;
            width: 30px;
            height: 30px;
            background: url();
        }
        .T-box {
            width: 400px;
            padding: 0 20px;
            text-align: left;
        }

        .T-box p {
            position: relative;
            height: 36px;
            line-height: 36px;
            font-size: 14px;
            margin-bottom: 15px;
        }

        .T-box p span {
            display: inline-block;
            padding-right: 15px;
            text-align: right;
            width: 110px;
            line-height: 36px;
            font-size: 14px;
        }

        .T-box p input, .T-box p select {
            width: 250px;
            padding: 0 5px;
            height: 34px;
            line-height: 34px;
            font-size: 14px;
            border: 1px solid #d3d3d3;
            outline: none;
        }

        .T-box p i {
            padding: 0 10px;
            line-height: 36px;
            font-style: normal;
        }

        .T-box p b {
            display: inline-block;
            margin-left: 10px;
            cursor: pointer;
            width: 60px;
            height: 36px;
            line-height: 36px;
            background: #c33;
            color: #fff;
            text-align: center;
            font-size: 13px;
            font-weight: normal;
        }
        .yinc{display: none;}
    </style>
    <div class="layui-tab layui-tab-brief" lay-filter="demo">
        <ul class="layui-tab-title">
            <ul class="layui-tab-title">
                <li><a th:href="@{/shop/goods_list}">网店商品管理</a></li>
                <li class="layui-this"><a th:href="@{/goods/publish_list}">商品网店发布记录</a></li>
                <!-- <li><a th:href="@{/pdd/goods_list(shopId=5)}">拼多多商品管理</a></li>
                <li><a th:href="@{/tao/goods_list(shopId=6)}">淘宝商品管理</a></li>
                <li><a th:href="@{/douyin/goods_list(shopId=22)}">抖店商品管理</a></li> -->
            </ul>
        </ul>
    </div>

    <!-- content starts -->
<!--    <blockquote class="layui-elem-quote">订单总览</blockquote>-->

    <fieldset class="layui-elem-field">
        <legend>按条件搜索</legend>
        <div class="layui-field-box">
            <form class="layui-form layui-form-pane1" method="get" action="/goods/publish_list">
                
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <input type="text" name="goodsNum" th:value="${goodsNum}" placeholder="商品编码" style="width: 200px;" class="layui-input">
                    </div>
                    <div class="layui-inline">
                        <div class="layui-input-inline">
                            <select name="shopId" id="shopId">
                                <option value="0" selected>请选择店铺</option>
                                <option  th:each="item: ${shops}" th:text="${item.name+' - '+item.typeName}" th:value="${item.id}">等待发货</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <button type="submit" class="layui-btn layui-btn-normal">搜索</button>
                        <i>总共：<span style="color: red" th:text="${totalSize}"></span>条记录</i>
                    </div>

                    <div class="layui-inline">
                        <span class="layui-btn layui-btn-primary" id="record_add">添加新商品纪录</span>
                    
                    </div>
                </div>


            </form>
        </div>
    </fieldset>

    <!-- start dd-wrapper -->
    <link rel="stylesheet" href="/goods/order.css"/>
    <div class="dd-wrapper">
        <table class="dd-table">
            <tr>
                <th>ID</th>
                <th>erpGoodsId</th>
                <th>商品编码</th>
                <th width="200px">标题</th>
                <th width="80px">主图</th>
                <th width="200px">素材路径</th>
                
                <th >成本价</th>
                <th>发布店铺Ids</th>
                <th>来源</th>
                <th>发布日期</th>
                <th>操作</th>
            </tr>
            <tr th:each="item:${lists}">
                <td th:text="${item.id}"></td>
               
                <td th:text="${item.erpGoodsId}"></td>
                <td th:text="${item.goodsNum}"></td>
                <td >
                    <span th:text="${item.goodsName}" th:title="${item.goodsName}"></span>
                </td>
                <td>
                    <div ><img th:src="${item.goodsImage}">
                    </div>
                </td>
                <td>
                    <span  th:text="${item.imagePath}"></span>
                    <i title="查看素材" th:if="${#strings.isEmpty(item.imagePath)==false}" th:attr="imagePath=${item.imagePath},data-id=${item.id}" class="layui-icon layui-icon-carousel imagePathView"></i>
                </td>
                <td>
                    <span  th:text="${item.goodsCost}"></span>
                </td>
                <td>
                    <li th:each="shop:${item.shopIds.split(',')}" >
                        <span class="layui-btn-sm layui-btn-primary" th:if="${shop.equals('5')}"><img src="https://mms-static.pddpic.com/express/favicon.ico" width="15px" height="15px" />&nbsp;梦小妮牛仔裤</span>
                        <span class="layui-btn-sm layui-btn-primary" th:if="${shop.equals('6')}"> <img src="https://img.alicdn.com/tps/i3/T1OjaVFl4dXXa.JOZB-114-114.png" width="15px" height="15px" />&nbsp;梦小妮牛仔裤</span>
                        <span class="layui-btn-sm layui-btn-primary" th:if="${shop.equals('22')}"><img src="https://lf1-fe.ecombdstatic.com/obj/eden-cn/upqphj/homepage/icon.svg" width="15px" height="15px" />&nbsp;梦小妮牛仔裤</span>
                        <span class="layui-btn-sm layui-btn-primary" th:if="${shop.equals('14')}"><img src="https://mms-static.pddpic.com/express/favicon.ico" width="15px" height="15px" />&nbsp;甘小姐de店</span>
                    </li>
                   
                </td>
                <td><a target="_blank" th:href="${item.sourceUrl}">来源</a></td>
                <td><span  th:text="${item.publishDate}"></span></td>
                <td>
                    <a href="javascript:;" class="layui-btn-sm layui-btn-primary edit_publish" th:attr="data-id=${item.id}" title="修改">
                        修改
                    </a>
                </td>
            </tr>
        </table>
    </div>
    <!-- end dd-wrapper -->
    <div class="layui-box layui-laypage layui-laypage-default pageBox">
        <paging:pager th:value="${pageIndex}" th:rows="${totalSize}" th:size="${pageSize}"/>
    </div>
    <script type="text/template" id="send-goods">
        <div class="T-box">
            <p><span>sku编码</span><input type="text" name="express_code"/></p>
            <p class="T-result"><span>&nbsp;</span><em id="erro"></em></p>
        </div>
    </script>
    <script type="text/javascript" src="/goods/Tips/Tips.min.js"></script>
    <script type="text/javascript">
        var layer;
        var $;
        var windowOpen;
        layui.use(['laydate', 'jquery', 'form', 'layer'], function () {
            var laydate = layui.laydate;
            $ = layui.jquery;
            var form = layui.form;
            layer = layui.layer;
            laydate.render({
                elem: '#startTime'
                ,type: 'datetime'
            });
            laydate.render({
                elem: '#endTime'
                ,type: 'datetime'
            });
            $(function () {
    
                $(".imagePathView").click(function(){
                    var imagePath = $(this).attr("imagePath");
                    var id = $(this).attr("data-id");

                    layer.open({
                        type: 2,
                        title: '查看素材库',
                        shadeClose: true,
                        shade: 0.8,
                        area: ['600px', '65%'],
                        content: '/goods/image_path_view?id='+id
                    });
                })

                $("#record_add").click(function(){
                    var imagePath = $(this).attr("imagePath");
                    var id = $(this).attr("data-id");

                    layer.open({
                        type: 2,
                        title: '添加新纪录',
                        shadeClose: true,
                        shade: 0.8,
                        area: ['600px', '65%'],
                        content: '/goods/goods_publish_add'
                    });
                })

                $(".edit_publish").click(function(){
                    var id = $(this).attr("data-id");

                    layer.open({
                        type: 2,
                        title: '修改发布网店',
                        shadeClose: true,
                        shade: 0.8,
                        area: ['600px', '65%'],
                        content: '/goods/goods_publish_edit_shops?id='+id
                    });
                })

            })

        });


    </script>

</div>
</body>
<html>
